//
//  FocusViewController.m
//  jingdong
//
//  Created by 陈明光 on 2021/7/31.
//  Copyright © 2021 陈明光. All rights reserved.
//

#import "FocusViewController.h"
#import "JXCategoryTitleView.h"
@interface FocusViewController ()<UINavigationControllerDelegate>
@property (nonatomic, strong) JXCategoryTitleView *myCategoryView;
@property (nonatomic, strong) NSMutableArray *dotStates;
@end

@implementation FocusViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
    
    NSMutableArray *titles = [NSMutableArray array];
    //    for (SCMatchTypeModel *aModel in self.titles) {
    //        [titles addObject:aModel.name];
    //    }
    
    self.myCategoryView.titles = @[@"关注",@"推荐",@"部落"];//titles;
    
    //不按下为灰色
    self.myCategoryView.titleColor = [UIColor grayColor];
    //按下停了下来页为蓝色
    self.myCategoryView.titleSelectedColor = UIColorFromRGBA(0x4A90E2,1);
    //未选中字体大小
    self.myCategoryView.titleFont = [UIFont systemFontOfSize:14];
    //选中字体大小
    self.myCategoryView.titleSelectedFont = [UIFont systemFontOfSize:16];
    self.myCategoryView.backgroundColor = UIColorFromRGBA(0xececec,1);//[UIColor grayColor];
    self.myCategoryView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleBottom;
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}

//分页控件的位置
- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    //后面加70是为了让首字缩进，如果没有就会顶出去，首字就会少一半在屏幕外面，而且加的值必须大于60
    self.myCategoryView.frame = CGRectMake(0, 0, self.view.frame.size.width + 70, 50);
}

- (JXCategoryTitleView *)myCategoryView {
    return (JXCategoryTitleView *)self.categoryView;
}

- (JXCategoryBaseView *)preferredCategoryView {
    return [[JXCategoryTitleView alloc] init];
}

#pragma mark - JXCategoryViewDelegate

- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
    //作为嵌套的子容器，不需要处理侧滑手势处理。示例demo因为是继承，所以直接覆盖掉该代理方法，达到父类不调用下面一行处理侧滑手势的代码。
    //    self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
}

#pragma mark - JXCategoryListContentViewDelegate

- (UIView *)listView {
    return self.view;
}

@end
